home *** CD-ROM | disk | FTP | other *** search
/ Gurewich OLE Controls for Visual Basic 4 / Gurewich OLE Controls for Visual Basic 4.iso / ocxprog / programs / ch10 / transpic.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-24  |  7.3 KB  |  212 lines

  1. VERSION 4.00
  2. Begin VB.Form frmTranspic 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "The Transparent Picture Program"
  5.    ClientHeight    =   5430
  6.    ClientLeft      =   1245
  7.    ClientTop       =   1650
  8.    ClientWidth     =   6015
  9.    Height          =   6120
  10.    Icon            =   "TRANSPIC.frx":0000
  11.    Left            =   1185
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5430
  14.    ScaleWidth      =   6015
  15.    Top             =   1020
  16.    Width           =   6135
  17.    Begin VB.CommandButton cmdChangeBackground 
  18.       Caption         =   "&Change Background Color"
  19.       Height          =   855
  20.       Left            =   1680
  21.       TabIndex        =   3
  22.       Top             =   4440
  23.       Width           =   2415
  24.    End
  25.    Begin TegoswLibCtl.Tegosw swExit 
  26.       Height          =   630
  27.       Left            =   0
  28.       TabIndex        =   2
  29.       Top             =   0
  30.       Width           =   525
  31.       _version        =   65536
  32.       _extentx        =   926
  33.       _extenty        =   1111
  34.       _stockprops     =   64
  35.       value           =   -1  'True
  36.    End
  37.    Begin TegopicLibCtl.TegoPic picButton 
  38.       Height          =   1470
  39.       Left            =   4440
  40.       TabIndex        =   1
  41.       Top             =   3840
  42.       Width           =   1470
  43.       _version        =   65536
  44.       _extentx        =   2593
  45.       _extenty        =   2593
  46.       _stockprops     =   65
  47.       backcolor       =   -2147483633
  48.       imagepicture    =   "TRANSPIC.frx":030A
  49.       maskpicture     =   "TRANSPIC.frx":1784
  50.       autosize        =   -1  'True
  51.    End
  52.    Begin TegopicLibCtl.TegoPic picBug 
  53.       Height          =   1575
  54.       Left            =   2040
  55.       TabIndex        =   0
  56.       Top             =   1560
  57.       Width           =   2175
  58.       _version        =   65536
  59.       _extentx        =   3836
  60.       _extenty        =   2778
  61.       _stockprops     =   65
  62.       imagepicture    =   "TRANSPIC.frx":2BFE
  63.       maskpicture     =   "TRANSPIC.frx":A5F8
  64.    End
  65.    Begin VB.Menu mnuFile 
  66.       Caption         =   "&File"
  67.       Begin VB.Menu mnuExit 
  68.          Caption         =   "E&xit"
  69.       End
  70.    End
  71.    Begin VB.Menu mnuHelp 
  72.       Caption         =   "Help"
  73.       Begin VB.Menu mnuAbout 
  74.          Caption         =   "&About..."
  75.       End
  76.    End
  77. Attribute VB_Name = "frmTranspic"
  78. Attribute VB_Creatable = False
  79. Attribute VB_Exposed = False
  80. ' All variables must be declared.
  81. Option Explicit
  82. Private Sub cmdChangeBackground_Click()
  83.  Static Background
  84.  ' Increment the Background static variable
  85.  Background = Background + 1
  86.  ' If Background is greater than 15, reset it to 0.
  87.  If Background > 15 Then Background = 0
  88.  ' Change the color of the form according to the
  89.  ' current value of Background.
  90.  Me.BackColor = QBColor(Background)
  91.  ' Change the background color of the picButton
  92.  ' and picBug transparent picture controls to the
  93.  ' new color of the form.
  94.  picButton.BackColor = Me.BackColor
  95.  picBug.BackColor = Me.BackColor
  96. End Sub
  97. Private Sub Form_Click()
  98.   MsgBox "You clicked the form."
  99. End Sub
  100. Private Sub mnuAbout_Click()
  101.    Dim Title
  102.    Dim Msg
  103.    Dim CR
  104.    CR = Chr(13) + Chr(10)
  105.    ' The title of the About message box.
  106.    Title = "About the Transparent Picture Program"
  107.    ' Prepare the message of the About message box.
  108.    Msg = "This program was written with Visual "
  109.    Msg = Msg + "Basic for Windows, using the "
  110.    Msg = Msg + "TegoSoft Transparent Picture OCX control. "
  111.    Msg = Msg + CR + CR
  112.    Msg = Msg + "The TegoSoft Transparent Picture OCX control "
  113.    Msg = Msg + "is part of the TegoSoft OCX Control "
  114.    Msg = Msg + "Kit - a collection of various OCX controls. "
  115.    Msg = Msg + CR + CR
  116.    Msg = Msg + "For more information about the "
  117.    Msg = Msg + "TegoSoft OCX Control Kit, contact TegoSoft "
  118.    Msg = Msg + "at:"
  119.    Msg = Msg + CR + CR
  120.    Msg = Msg + "TegoSoft Inc." + CR
  121.    Msg = Msg + "P.O. Box 389" + CR
  122.    Msg = Msg + "Bellmore, NY 11710"
  123.    Msg = Msg + CR + CR
  124.    Msg = Msg + "Phone: (516)783-4824"
  125.    ' Display the About message box.
  126.    MsgBox Msg, vbInformation, Title
  127. End Sub
  128. Private Sub mnuExit_Click()
  129.   ' Terminate the program.
  130.   Unload Me
  131. End Sub
  132. Private Sub picBug_ClickImage(ByVal Transparent As Boolean)
  133. ' If Transparent is equal to False, it means that
  134. ' the user clicked a non-transparent section of the
  135. ' picture. If however, Transparent is equal to True,
  136. ' it means that the user clicked a transparent
  137. ' section of the picture (i.e. the user clicked the form).
  138. ' If the user clicked a transparent section of the
  139. ' picture, execute the Form_Click procedure. Otherwise,
  140. ' display a message box.
  141. If Transparent = True Then
  142.    Form_Click
  143.    MsgBox "You clicked the bug."
  144. End If
  145. End Sub
  146. Private Sub picButton_ClickImage(ByVal Transparent As Boolean)
  147. ' If Transparent is equal to False, it means that
  148. ' the user clicked a non-transparent section of the
  149. ' picture. If however, Transparent is equal to True,
  150. ' it means that the user clicked a transparent
  151. ' section of the picture (i.e. the user clicked the form).
  152. ' If the user clicked a transparent section of the
  153. ' picture, execute the Form_Click procedure. Otherwise,
  154. ' display a message box.
  155. If Transparent = True Then
  156.    Form_Click
  157.    MsgBox "You clicked the diagonal pushbutton."
  158. End If
  159. End Sub
  160. Private Sub picButton_MouseDownOnImage(ByVal Transparent As Boolean, ByVal x As Integer, ByVal y As Integer, ByVal Button As Integer)
  161. ' If Transparent is equal to False, it means that
  162. ' the user pressed the mouse button down over
  163. ' a non-transparent section of the picture.
  164. ' If however, Transparent is equal to True,
  165. ' it means that the user pressed the mouse button
  166. ' down over a transparent section of the picture
  167. Dim Path
  168. ' Get the name of the directory where the
  169. ' program resides.
  170. Path = App.Path
  171. If Right(Path, 1) <> "\" Then
  172.    Path = Path + "\"
  173. End If
  174. ' If the user pressed the mouse button down over
  175. ' a non-transparent region of the diagonal pushbutton
  176. ' picture, display a picture that shows the diagonal
  177. ' pushbutton in its Down position.
  178. If Transparent = False And Button = 1 Then
  179.    picButton.SetImageAndMask LoadPicture(Path + "button2.bmp"), LoadPicture(Path + "mbutton2.bmp")
  180. End If
  181. End Sub
  182. Private Sub picButton_MouseUpOnImage(ByVal Transparent As Boolean, ByVal x As Integer, ByVal y As Integer, ByVal Button As Integer)
  183.   Dim Path
  184.   ' Get the name of the directory where the
  185.   ' program resides.
  186.   Path = App.Path
  187.   If Right(Path, 1) <> "\" Then
  188.      Path = Path + "\"
  189.   End If
  190.  ' Display a picture that shows the diagonal pushbutton
  191.  ' in its Up position.
  192.  picButton.SetImageAndMask LoadPicture(Path + "button1.bmp"), LoadPicture(Path + "mbutton1.bmp")
  193. End Sub
  194. Private Sub swExit_Click()
  195.    Dim Title
  196.    Dim Question
  197.    Dim Response
  198.    ' If the user turned the swExit switch OFF,
  199.    ' confirm that the user wants to exit the
  200.    ' program, and if so, exit the program.
  201.    If swExit.Value = False Then
  202.       Title = "Exit Program"
  203.       Question = "Are you sure you want to exit?"
  204.       Response = MsgBox(Question, vbYesNo + vbQuestion, Title)
  205.       If Response = vbYes Then
  206.          Unload Me
  207.       Else
  208.          swExit.Value = True
  209.       End If
  210.    End If
  211. End Sub
  212.